const sha1 = require('sha1');
/**
 * 消息是否来自微信官方
 */
exports.isFromWeichat = function (queryObj) {
    try {
        const { signature, echostr, timestamp, nonce } = queryObj;
        const { token } = config;
        const arr = [timestamp, nonce, token];
        const arrSort = arr.sort();
        const str = arrSort.join("");
        const sha1Str = sha1(str);
        return sha1Str === signature;
    } catch (error) {
        console.log(error);
    }
}